import React from 'react';
import BaseVideoController from './BaseVideoController';
import { FieldChangeData, LCGUI } from '../../../json-schema/LCGUI';
import { Control } from '../../../json-schema/SchemaTypes';
import { ConfigType } from '../../../designer/right/ConfigContent';

export const BaseVideoStyleConfig: React.FC<ConfigType<BaseVideoController>> = ({ controller }) => {
  const config = controller.getConfig()?.style;

  const onFieldChange = (fieldChangeData: FieldChangeData) => {
    const { dataFragment } = fieldChangeData;
    controller.update(dataFragment);
  };

  const schema: Control = {
    type: 'grid',
    key: 'style',
    children: [
      {
        type: 'input',
        label: '视频地址',
        key: 'src',
        value: config?.src,
      },
    ],
  };

  return <LCGUI schema={schema} onFieldChange={onFieldChange} />;
};
